How to use filtering techniques:

What must be defined to the standard IBM IFASMFDP orIFASMFDL JCL when processing SMF data?

1. Add these 2 statements in the //SYSIN JCL stream
USER2(SMF$XT20)
USER3(SMF$XT21)

or in conjunction with IRRADU00/86 utilization:

USER2(SMF$XT30)
USER3(SMF$XT31)



2. Add the following DDnames to JCL stream
//FLTPRINT DD SYSOUT=* (prints the filter control statements)
//FLTINPUT DD * (contains the control statements)

3. define one or more +INCLUDE COND= control statements to //FLTINPUT DD *
Use an INCLUDE statement if you want only certain records to appear in the output data set. The INCLUDE statement selects the records you want to include.
You can specify multiple INCLUDE statements.



Standard INCLUDE filter statement
+INCLUDE COND=(................) ,AND/OR,(..........))


Standard EXCLUDE filter statement
+INCLUDE COND=(................) ,AND/OR,(..........))



COND= keyword (or optionally WHEN= can be specified)
COND=(startpos,length,format,comparison,string {,AND or OR,} ..........)



or take advantage of optional enhanced filtering techniques processing relocatable sections:
COND=(startpos
{(a,b,c,d,e)},length,format,comparison,string {,AND or OR,} ..........)

  • {(a,b,c,d,e)} These positional parameters allow a user to process relocatable sections as found in SMF.



or take advantage of optional enhanced filtering techniques processing by scanning a whole buffer/record:
COND=(startpos,length,format,comparison,string
{,type,scanlen} {,AND or OR,} ..........)

  • {,type,scanlen} These positional parameters allow to scan a whole record for a given ‚string‘. This facility is very beneficial in case a user is interested in any record where a ‚string‘ occurs, whereby the exact ‚string‘ location is irrelevant e.g. get all records where the user-ID IBMUSER occurs.



Startpos:
  • startpos absolute position where the data string starts. Valid value is 1-32760.

Length:
  • length absolute value which defines the length. The valid value depends on the supplied format e.g. for the format CH the max value is 255.

Format:
  • CH Character - max. 255
  • CG Character generic compare - max. 255 - comparison operator can only be EQ or NE
  • HX Hexadecimal - max. 32
  • PD packed decimal - max. 15
  • BI binary - max. 32

Extended Format (Sx):
If the extended ‘format’ is used, a compare will be done in the length of the supplied ‘string’. For the supplied ‘string’ beginning at ‘startpos’ will be scanned for by the supplied length until found. As an alternative you can use as well {,type,scanlen} especially when working with variable records. You should not intermix these 2 methods.
  • SC Character - max. 255 (refers to ‘string’ length)
  • SG Character generic compare - max. 255 - comparison operator can only be EQ or NE (refers to ‘string’ length)
  • SX Hexadecimal - max. 32 (refers to ‘string’ length)
  • SB binary - max. 32 (refers to ‘string’ length)

  • Comparison operators are as follows:
  • EQ Equal to
  • NE Not equal to
  • GT Greater than
  • GE Greater than or equal to
  • LT Less than
  • LE Less than or equal to


Type and scanlen (optional):
  • type: valid values are: F = record format(RECFM) is fix or V = variable - By using ‚type‘ and the ‚scanlen‘ positional parameters it is possible to scan a whole record for the occurrence of a given ‚string‘ value. There may be the need to include/exclude records, whereby the absolute location may not be known. This is a feature not found using the standard SORT INCLUDE COND= programs, as you have to know the exact location where a value should occur. I.e. a user wants to select all records, where the ‚string‘ e.g. IBMUSER appears anywhere within each record.


  • scanlen - The ‚scanlen‘ parameter specifies how many bytes within the record shall be scanned for the specified ‚string‘. Valid values are ‚*‘ or 0-32760 or an allocated DDNAME. A ‚*‘ is equal 0. When an allocated DDNAME is specified, we will extract the LRECL from its DCB to find out how many bytes have to be scanned for the ‚string‘ value. If the ‚type‘ is set to ‚V‘ and the ‚scanlen‘ is set to ‚*‘ or ‚0‘, then the ‚scanlen‘ value will be extracted from the RDW(record description word) which contains the length of the record. It is the users responsibility to know if the records passed to this program have a RECFM=F or RECFM=V. The program will always internally calculate how many bytes have to be scanned based on the ‚startpos‘ and ‚length‘ parameters supplied plus the ‚scanlen’ parameter to avoid any overflow. An error message will be issued and/or records will be bypassed in case of an error depending of the specifications made.







A relational condition specifies a comparison, substring comparison test, bit logic test or numeric test to be performed. Relational conditions can be logically combined, with AND or OR, to form a logical expression. Nesting of parentheses has been limited to 16 levels. The number of INCLUDE/EXCLUDE statements is only limited by the amount of storage available.

+INCLUDE COND=(((1,4,EQ,CH,C'B1'),AND,(2,4,EQ,CH,C'B2')),OR,
((3,4,EQ,CH,C'B3'),AND,(4,4,EQ,CH,C'B4')),OR,
((5,4,EQ,CH,C’B3’),AND,(6,4,EQ,CH,C’B5’)))



Sample for generic filtering
Generic search: This is an option not seen under e.g. DFSORT etc. It allows to perform a generic search e.g. when searching for file names.
+INCLUDE COND=(5,44,CG,EQ,’?2?? X*')
+INCLUDE COND=(5,008,CG,EQ,ACC*,AND,286,44,CG,EQ,RA2002.V3R7M0*.**,
AND,578,8,CH,EQ,DATASET)


Sample BINARY
+INCLUDE COND=(1,4,BI,EQ,11111111000000001111111100000000)

Sample CHARACTER
+INCLUDE COND=(((1,8,CH,EQ,'41112222')))

Sample PACKED DECIMAL
+INCLUDE COND=(1,7,PD,EQ,20)
+INCLUDE COND=(1,7,PD,EQ,+020)

Sample HEXADECIMAL
+INCLUDE COND=((5,2,HX,EQ,1E02))


Sample scanning a whole record using ‚type‘ and ‚scanlen‘ parameters. The ‚scanlen‘ will be extracted from the RDW.
+INCLUDE COND=((0006,5,CH,EQ,MARCO,V,*),OR,
(0006,4,CH,EQ,AMEX
,V,*))
//
+INCLUDE COND=((0006,5,CH,EQ,MARCO
,V,*),AND,
(0006,4,CH,EQ,TEST
,V,*))
//

* Find any field within a record at pos. 6 in the length of 4 characters starting with „IKJ“.
* The record(scan) size will be extracted from the RDW.
+INCLUDE COND=((0006,04,CG,EQ,IKJ*
,V,*))
//

Sample scan 44 bytes beginning at startpos. 1 for occurrence of the value ‘e1112222’.
+INCLUDE COND=(1,44,SC,EQ,’41112222’)



For processing relocatable sections click on this LINK.

For using symbolic names when processing SMF, IRRADU00 or IRRDBU00 data click on this LINK.

Note
You can mix +INCLUDE and +EXCLUDE statements but it is not recommended. The program will process all statements ‚until‘ the first match occurred. If no match at all occurred, a record will be ignored.


Please note, that e.g. the IBM DFSORT supports only one INCLUDE or EXCLUDE(OMIT) statement. You cannot have both defined.